﻿@using Apps.Web.Core;
@using Apps.Web;
@using Apps.Common;
@using Apps.Models.Sys;
@using Apps.Locale;
@{
    ViewBag.Title = "自采煤批次信息";
    Layout = "~/Views/Shared/_Index_Layout.cshtml";
    List<permModel> perm = null;
}
<script src="~/Scripts/common.js"></script>
<div class="mvctool">
    <input id="txtQuery" type="text" class="searchText" placeholder="批次编号" />
    <input id="RFID" type="text" class="searchText" style="width:280px" placeholder="样桶卡号" />
    <select class="easyui-combobox" name="TYPE_ID" id="TYPE_ID" style="width:250px;"></select>
    @Html.ToolButton("btnQuery", "fa fa-search", Resource.Query, ref perm, "Query", true)
</div>
<table id="List"></table>
@Html.Partial("~/Views/Shared/_Partial_AutoGrid.cshtml")

<script type="text/javascript">
    $(function () {
        $('#List').datagrid({
            url: '@Url.Action("GetList")',
            width:SetGridWidthSub(10),
            methord: 'post',
            height: SetGridHeightSub(45),
            fitColumns: true,
            sortName: 'TIME',
            sortOrder: 'desc',
            idField: 'SAMPLING_ID',
            pageSize: 15,
            pageList: [15, 20, 30, 40, 50],
            pagination: true,
            striped: true, //奇偶行是否区分
            singleSelect: true,//单选模式
            rownumbers: true,//行号
            onLoadSuccess: function(data) {
            },
            columns: [[
                { field: 'BATCH_CODE', title: '批次号', width: 80, sortable: true },
                { field: 'TEAM_NAME', title: '班组名称', width: 80, sortable: true },
                { field: 'TEAM_ID', title: '班组编号', width: 80, sortable: true, hidden: true },
                { field: 'MATERIEL_NAME', title: '物料名称', width: 80, sortable: true },
                { field: 'SUPPLIER_NAME', title: '供应商名称', width: 80, sortable: true,hidden: true },
                { field: 'SUPPLIER_ID', title: '供应商编号', width: 80, sortable: true, hidden: true },
                { field: 'TYPE_STR', title: '类型描述', width: 80,sortable:true },
                { field: 'TYPE', title: '类型', width: 80, sortable: true, hidden: true },
                { field: 'TIME', title: '生成时间', dateFormat:'{0:d}', width: 80, sortable: true },
                { field: 'SAMPLING_ID', title: '采样编号', width: 80, sortable: true,hidden: true },
                { field: 'SAMPLE_USER_NAME', title: '采样员', width: 80,sortable:true },
                { field: 'SAMPLE_USER_ID', title: '采样员', width: 80, sortable: true, hidden: true },
                { field: 'SAMPLE_TIME', title: '采样时间', dateFormat: '{0:d}', width: 80,sortable:true },
                { field: 'RFID', title: '采样桶号RFID', width: 80, sortable: true },
                { field: 'REVICED', title: '是否已交接', width: 80, sortable: true, formatter: function (val) { return val=='0'?"否":"是" } },
                
                { field: 'MATERIEL_ID', title: '物料编号', width: 80, sortable: true, hidden: true },
                { field: 'MAKE_CODE', title: '制样编码', width: 80,sortable:true },
                { field: 'MADE', title: '是否已制样', width: 80, sortable: true, formatter: function (val) { return val == '0' ? "否" : "是" } },
                { field: 'BLENDED', title: '是否已合样', width: 80, sortable: true, formatter: function (val) { return val == '0' ? "否" : "是" } }
            ]]
        });



        if (@Html.FieldShow(ref perm,"IsShow")== 0) {
            $('#List').datagrid('hideColumn', 'MATERIEL_NAME');
            $('#List').datagrid('hideColumn', 'SUPPLIER_NAME');
        }
    });
    $(function () {
        $.ajax({
            url: '../../RC/SAMPLING/GetTranSuppList?type=4',
            type: 'post',
            dataType: 'json',
            success: function (result) {
                $('#TYPE_ID').combobox({
                    data: result,
                    valueField: 'Value',
                    textField: 'Text',
                    onLoadSuccess: function () {
                        
                    }
                });
            },
        });
       
        $("#btnQuery").click(function () {
            var queryStr = $("#txtQuery").val();
            var typeId = $("#TYPE_ID").combobox('getValues').toString();
            var RFID = $("#RFID").val();
            if (queryStr == null) {
                queryStr = "%";
            }
            $("#List").datagrid("load", { queryStr: queryStr, typeId: typeId, RFID: RFID });

        });

       

    });

</script>

